clear 
clc

imagePath = 'training_set'; % using relative path instead of absolute path
data = cell(1, 3);
data{1} = readImages(strcat(imagePath, '\Diamond'));      % Diamond images
data{2} = readImages(strcat(imagePath, '\Line'));             % Line images
data{3} = readImages(strcat(imagePath, '\Ellipse'));          % Ellipse images

training_output = cell(3, 3);

% training images
[training_output{1,1}, training_output{1,2}, training_output{1,3} ] = trainData(data{1});
[training_output{2,1}, training_output{2,2}, training_output{2,3} ] = trainData(data{2});
[training_output{3,1}, training_output{3,2}, training_output{3,3} ] = trainData(data{3});

% format the data and only save it in the general format
train = formatMatrix(training_output);

% save the training set to a file
savefile = 'trainedData.mat';
save(savefile, 'train');

clear
clc